/**
 * describe:
 *
 * @author chaP
 * @date 2019/04/02
 */
package CodingTest.AC20190402;

/**
 * 翻转二叉树
 */
public class invertTree {
    class TreeNode{
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode(int x){val = x;}
    }
    public TreeNode invertTree(TreeNode root){
        if(root!=null) {
            TreeNode temp = root.left;
            root.left = root.right;
            root.right = temp;
            invertTree(root.left);
            invertTree(root.right);
        }
        return root;
    }

}
